home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir43 / qsrc_dsk.zip / MODEL / BROWSEB.PRG < prev    next >
Text File  |  1991-12-17  |  3KB  |  71 lines

  1. *       ╓─────────────────────────────────────────────────────────╖
  2. *       ║                                                         ║
  3. *       ║ BROWSEB.PRG                                             ║
  4. *       ║                                                         ║
  5. *       ╟─────────────────────────────────────────────────────────╢
  6. *       ║ Application Developed in _Using FoxPro 2_               ║
  7. *       ║                                                         ║
  8. *       ║ Lisa C. Slater and Steven E. Arnott                     ║
  9. *       ║                                                         ║
  10. *       ║ Copyright (c) 1991 Que Publishing                       ║
  11. *       ║                                                         ║
  12. *       ╙─────────────────────────────────────────────────────────╜
  13.  
  14.  
  15. * We used this simple procedure while we wrote the
  16. * book to set up a browse in which we could create the data 
  17. * in the budget file interactively.
  18.  
  19. * It serves to demonstrate some of the concepts you learn
  20. * in Chapters 3 and 8 (browsing related files, validating
  21. * data as you enter it interactively, using calculated fields).
  22.  
  23. * MODIFYing a MEMO along with its other browse fields is demonstrated
  24. * here as well. 
  25.  
  26. * The :V clause on the Period field could easily have been made into a 
  27. * User Defined Function instead of a complex expression.
  28. * This particular validation (using only the first day of the quarter)
  29. * turned out to be unnecessary in the way we used the field for querying
  30. * purposes; see the expression used to determine the Quarter for any
  31. * date presented in chap5004.qpr, and in Chapter 13 as the FUNCTION Pd() 
  32. * in the code for BUDGET.SCX.
  33.  
  34. * If you have already run CreateV.PRG,
  35. * you can substitute the line
  36. * SET VIEW TO Model
  37. * for all the lines before the actual BROWSE command.
  38.  
  39. CLEAR
  40. CLOSE ALL
  41. USE Budget
  42. USE Budcat ORDER TAG budcatcode IN SELECT(1)
  43. USE Product ORDER TAG prodcode IN SELECT(1)
  44. USE Dept ORDER TAG deptcode IN SELECT(1)
  45. SET RELATION TO budcatcode INTO Budcat,;
  46.                 prodcode   INTO Product,;
  47.                 deptcode   INTO Dept 
  48. DEFINE WINDOW memob FROM  17,1 TO 23,78 COLOR SCHEME 10
  49. DEFINE WINDOW browseb FROM 2,1 TO 15,78 COLOR SCHEME 10
  50.  
  51. MODI MEMO budget.notes SAVE NOWAIT WINDOW memob
  52. BROWSE;
  53.   FIELDS budget.deptcode   :V=!EOF("Dept") :E= "Invalid code!",    ;
  54.          budget.prodcode   :V=!EOF("Product") :E= "Invalid code!", ;
  55.          budget.budcatcode :V=!EOF("budcat") :E= "Invalid code!",  ;
  56.          budget.period     :V= INLIST(MONTH(period),1,4,7,10) AND  ;
  57.                                DAY(period) = 1                     ;
  58.                            :E= "Use first day of quarter!",        ;
  59.          budget.budgetamt,;
  60.          budget.final :H="Fnl?",;
  61.          product.prodname :W =.F. :15 ,;
  62.          howmany = STR(RECNO(),2) :H="#Recs" ;
  63.   VALID :F ! EMPTY(budget.deptcode) AND  ;
  64.            ! EMPTY(budget.prodcode) AND  ;
  65.            ! EMPTY(budget.budcatcode)    ;
  66.   ERROR "No empty codes!"                ;
  67.   TITLE "Creating Budget File for Widget Model Application: "+MDY(DATE()) ;
  68.   WINDOW browseb SAVE NOWAIT
  69. RELEASE WINDOW browseb  
  70.  
  71. RETURN